﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZX.SYS.Library;
using ZX.BLL.Extend;
namespace ZX.SYS.Bussiness.Phrase
{
    public partial class B_Announce : BLL.Extend.BaseBussnies<Announce>
    {
        public B_Announce() { this.entity = new Announce(); }
        /// <summary>
        ///   删除通知公告
        /// </summary>
        /// <param name="announceId">通知公告ID</param>
        public void DeleteAnnounce(Guid announceId)
        {
            Announce old = (Announce)this.GetEntityById(announceId.ToString());
            if (old == null)
                throw new ApplicationException("不存在的记录");

            try
            {
                BaseBussnies<AnnounceDepartment> bll = new BaseBussnies<AnnounceDepartment>();
                string condition = "announceID='{0}'";
                condition = string.Format(condition, announceId);
                bll.Delete(condition);

                BaseBussnies<AnnounceAccessories> bllAccessories = new BaseBussnies<AnnounceAccessories>();
                condition = "announceID='{0}'";
                condition = string.Format(condition, announceId);
                bllAccessories.Delete(condition);
                this.Delete(old);
            }
            catch (Exception e)
            {
                throw new ApplicationException("系统错误:" + e.Message);
            }
        }
    }
}
